function getUrlParam(name) {
    //构造一个含有目标参数的正则表达式对象
    let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    //匹配目标参数
    let r = window.location.search.substr(1).match(reg);
    //返回参数
    if (r != null) {
        return unescape(r[2]);
    } else {
        return null;
    }
}
let userId = getUrlParam('userId');
let userId_const = localStorage.getItem("userId");
let userName_const = localStorage.getItem("userName");

$(document).ready(function () {
    $(function (){


        let userName=decodeURIComponent(window.location.search.split("&")[1]);//防止乱码
        console.log("userId"+userId);
        console.log("userName"+userName);

        let username = $(".dropdown-user-name");
        username.find('i').remove();
        let user_name = '<i>你好，'+userName_const+'老师</i>';
        username.append(user_name);                       //生成导航栏的老师名字
        username = $("#user_name");
        username.find('span').remove();
        user_name = '<span>'+userName_const+'老师</span>';      //生成导航栏下拉框的老师名字
        username.append(user_name);

    })
})



